package day04;

import java.math.BigInteger;
import java.util.Scanner;

/**
 * @author feng
 * @Date 2021/9/10 7:06
 * 大数运算：抽奖概率问题
 */
public class BigIntegerTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("抽取多少个数K计算？");
        int a = sc.nextInt();
        System.out.println("多少个数字中抽取n？");
        int b = sc.nextInt();
        // 利用BigInteger计算表达式
        BigInteger lott = BigInteger.valueOf(1);
        for (int i = 1; i <=a ; i++) {
            lott = lott.multiply(BigInteger.valueOf(b-i+1).divide(BigInteger.valueOf(i)));
        }
        System.out.println("计算结果" +lott );
    }
}
